<template>
	 <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="82px">
      <el-form-item label="订单号" prop="orderNo">
        <el-input
          v-model = 'queryParams.orderNo'
          placeholder="订单号"
          clearable
          size="small"
        />
      </el-form-item>
       <el-date-picker
      v-model="timevalue"
      type="daterange"
      range-separator="至"
      start-placeholder="开始日期"
      end-placeholder="结束日期">
    </el-date-picker>
      <el-form-item label="外部订单号" prop="serialNumber">
        <el-input
          v-model = 'queryParams.serialNumber'
          placeholder="外部订单号"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="经手人" prop="operatorName">
        <el-input
          v-model = 'queryParams.operatorName'
          placeholder="经手人"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="代理商" prop="userName">
        <el-input
          v-model = 'queryParams.userName'
          placeholder="经手人"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="充值金额" prop="rechargeMoney">
        <el-input
          v-model = 'queryParams.rechargeMoney'
          placeholder="充值金额"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="订单状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="状态">
			<el-option key="1" label="未核对" value="1"></el-option>
			<el-option key="2" label="已核对" value="2"></el-option>
		</el-select>
      </el-form-item>
      
     </el-form>
      <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          @click='search'
        >查询</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-col>
    </el-row>
    
     <el-table v-loading="loading" :data="rechargeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="订单号" align="center" prop="orderNo" />
      <el-table-column label="外部订单号" align="center" prop="serialNumber" />
      <el-table-column label="经手人" align="center" prop="operatorName" />
      <el-table-column label="创建时间" align="center" prop="createTime" />
      <el-table-column label="代理商名称" align="center" prop="userName" />
      <el-table-column label="充值前金额（元）" align="center" prop="beforeMoney" />
      <el-table-column label="充值后金额（元）" align="center" prop="afterMoney" />
      <el-table-column label="充值金额（元）" align="center" prop="rechargeMoney" />
	   <el-table-column label="状态" align="center" prop="status" > 
	  	<template slot-scope="scope">
          <el-tag v-if="scope.row.status=='1'">未核对</el-tag>
          <el-tag type="success" v-if="scope.row.status=='2'">已核对</el-tag>
        </template> 
        </el-table-column>
      <!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
          <el-button type="primary" icon="el-icon-edit" circle ></el-button>
          <el-button type="danger" icon="el-icon-delete" circle ></el-button>
        </template> 
      </el-table-column>-->
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getTcListFn"
    />
    

    </div>
</template>

<script>
	import {getRechargeList} from "@/api/recharge/recharge";
	export default{
		data(){
			return{
				timevalue: undefined,//时间
				queryParams:{
					pageNum:1,
					pageSize:10,
					orderNo:null,   //订单号
					serialNumber:null,  //外部订单号
					operatorName:null,  //经手人
					userName:null,  //企业名
					rechargeMoney:null,  //充值金额
					status:null,  //订单状态
				},
				single:'',
				multiple:'',
				rechargeList:[],
				total:0,  //总条数
				loading:false,
				title:'新增销售价',
				openTC:false,    //修改套餐弹框
				isEdit:false,  //是否编辑
				taocanTypeListIstype:[],  //套餐名称list
				isDisabled:false,   //是否禁止弹框选择
				tcData:{
					pricingName:null,  //套餐名称
					pricingId:null,   //套餐ID
					ispType:null,   //运营商
					status:'0',   //上下架状态
					sellAmt:null   //销售价
				},
				rules:{
					 pricingId:[{ required: true,message: "套餐不能为空",trigger: "change" }],
			
				}
			}
		},
		mounted(){
			this.getTcListFn();
		},
		methods:{
			getTcListFn(){
				var queryParams = this.queryParams;
				this.loading = true;
				getRechargeList(queryParams).then((res)=>{
					console.log(res);
					this.rechargeList=res.rows;
					this.loading = false;
				})
			},
			search(){
				 this.queryParams.pageNum = 1;
      var timevalue = this.timevalue;
      if(timevalue){
      var startTime = new Date(timevalue[0]).getFullYear()+'-'+(new Date(timevalue[0]).getMonth()+1)+'-'+new Date(timevalue[0]).getDate();
      var endTime =  new Date(timevalue[1]).getFullYear()+'-'+(new Date(timevalue[1]).getMonth()+1)+'-'+new Date(timevalue[1]).getDate();
      this.queryParams.startTime1 = startTime;
      this.queryParams.endTime1 = endTime;
      }
      console.log( this.queryParams);
				this.getTcListFn();
			},
			  /** 重置按钮操作 */
    resetQuery() {
    	this.timevalue = undefined;
    	this.queryParams={
					pageNum:1,
					pageSize:10,
					orderNo:null,   //订单号
					serialNumber:null,  //外部订单号
					operatorName:null,  //经手人
					userName:null,  //企业名
					rechargeMoney:null,  //充值金额
					status:null,  //订单状态
				}
    },
			 // 多选框选中数据
		    handleSelectionChange(selection) {
		      //this.ids = selection.map(item => item.postId)
		      this.single = selection.length!=1
		      this.multiple = !selection.length
		    },
		}
	}
</script>

<style>
</style>